import 'package:flutter/material.dart';

import 'package:get/get.dart';
import 'package:myapp/app/theme/app_color.dart';
import 'package:myapp/app/utils/platform_utils.dart';
import 'package:webview_flutter/webview_flutter.dart';

import '../controllers/article_details_controller.dart';

class ArticleDetailsView extends GetView<ArticleDetailsController> {
  @override
  Widget build(BuildContext context) {
    if (PlatformUtils.isAndroid) {
      WebView.platform = SurfaceAndroidWebView();
    }
    return Scaffold(
      appBar: AppBar(
        title: Text('文章详情', style: TextStyle(color: AppColor.white, fontSize: 16),),
        centerTitle: true,
        backgroundColor: AppColor.red80,
      ),
      body: WebView(
        initialUrl: Get.arguments['url'],
        onPageStarted: (url) {
          Get.defaultDialog(
              title: "loading", content: CircularProgressIndicator());
        },
        onPageFinished: (url) {
          Get.back();
        },
      ),
    );
  }
}
